$(function () {
    var flowid = window.location.hash;
    var searchs = window.location.search.split("&");
    //获取流程名称，为重命名流程名称使用
    var flowNameTitle = window.document.title;
    var datalength = "a";
    //连线信息
    var connections = [];
    searchs.forEach(function (item, index) {
        if (item.indexOf("datalength=") > -1) {
            datalength = item.replace("datalength=", "");
        }
    })
    if (Number(datalength) == NaN) {
        datalength = "a";
    }
    //保存节点和节点注释之间的映射关系  节点ID：[注释内容1,注释内容2]
    var nodenoteBookMap = {};
    //保存流程注释信息
    var flowNoteBookList = [];
    if (flowid && flowid.trim().length > 0) {
        flowid = flowid.substr(1);
    }
    var param = TempoUtils.unSerialize(window.location.search);
    var useApi = param.mode == 'inline';
    var oView = $('#tempo-mine-viewing-resultshow');

    var mask = $("<div/>").tempoprogressbar();

    var insightCache = {};

    var api = {
        "processInfo": contextPath + "/api/ai/app/insight/get-process-info",
        "flowView": contextPath + "/api/ai/app/insight/get-flow-info-object",
        "allNodeInsight": contextPath + "/api/ai/app/insight/list-all-node",
        "nodeInsight": contextPath + "/api/ai/app/insight/list-node-info",
        "portInsight": contextPath + "/api/ai/app/insight/get-node"
    };

    var postInsight = function (param) {
        if (useApi && param.url.endsWith('searchProcessInsightInfo')) {
            param.url = api['processInfo'];
            param.data.serviceid = param.data.flowId;
        } else if (useApi && param.url.endsWith('searchInsightInfo')) {
            param.url = api['allNodeInsight'];
            param.data.serviceid = param.data.flowId;
        } else if (useApi && param.url.endsWith('searchInsightInfoById')) {
            param.url = api['portInsight'];
            param.data.portcode = param.data.id;
        } else if (useApi && param.url.endsWith('getObjectFlowInfoForView')) {
            param.url = api['flowView'];
            param.data.serviceid = param.data.flowId;
        }
        $.ajax(param);
    }
    /**
     * 概览
     */
    var loadOver = function () {
        postInsight({
            url: contextPath + "/api/ai/mine/searchProcessInsightInfo",
            data: {
                flowId: flowid,
                exeId: exeId,
            },
            success: function (result) {
                if (result && result.success != undefined) {
                    result = result.data;
                }
                if (!result || !result.processData) {
                    if (mask) {
                        mask.tempoprogressbar('close');
                    }
                    return
                }
                var insightData = result.processData;
                if (!insightData.desc) {
                    insightData = JSON.parse(insightData);
                }
                var flowHeader = $("<h1>").appendTo(oView).css('text-align', 'center');
                flowHeader.text(flowNameTitle ? flowNameTitle : insightData.desc.processName);
                var summaryPanel = $('<div id="summary-container">').appendTo(oView).accordionpanel({
                    expanded: true,
                    title: TempoUtils.locale("mine.summarize"),
                    link: TempoUtils.locale("mine.daochubaogao"),
                    linkHandler: function () {
                        var pmmls = $(".tempo-pmml-insight");
                        if (pmmls.length > 0) {
                            for (var i = 0; i < pmmls.length; i++) {
                                if ($($(".tempo-pmml-insight")[i]).is(":hidden")) {
                                    $($(".tempo-pmml-insight")[i]).empty();
                                }
                            }
                        }
                        if (mask) {
                            mask.tempoprogressbar('close');
                        }
                        mask = $("<div/>").tempoprogressbar();
                        var formItems = $('body').find('select, select[class="tempo-selectmenu"], input, input[class="tempo-numberbox"], input[class="tempo-validatebox"]');
                        if (formItems && formItems.size() > 0) {
                            formItems.replaceWith(function () {
                                var text = $(this).val() || $(this).text();
                                if ($(this).is("select")) {
                                    var index = this.selectedIndex;
                                    var nodes = this.children;
                                    if (nodes[index]) {
                                        text = nodes[index].innerText;
                                    }
                                }
                                if ($(this).is('[type="radio"]')) {
                                    if (!$(this).is(':checked')) {
                                        $(this).parent('td').remove();
                                    } else {
                                        $(this).remove();
                                    }
                                }
                                return "<span>" + text + "</span>"
                            })
                        }
                        summaryPanel.find('.accordionpanel-header-link').hide();
                        if (mask) {
                            mask.tempoprogressbar('close');
                        }
                        mask = $("<div/>").tempoprogressbar();
                        var imgs = $('img').filter(function () {
                            return !$(this).attr('src').startsWith('data:');
                        });

                        imageUrlToBase64(imgs, 0, function () {
                            $('<div/>').text("正在导出报告，请稍等").css({
                                position: 'fixed',
                                width: '100%',
                                height: '100%',
                                zIndex: 10000,
                                background: '#EAEDF1',
                                top: 0,
                                left: 0,
                                textAlign: 'center',
                                fontSize: '24px',
                                paddingTop: '20%'
                            }).appendTo($('body'));
                            //导出word之前对某些元素做特殊处理
                            updateHtml();
                            $("body").inlineStyler();
                            canvg();
                            $('body').find('canvas').each(function () {
                                $(this).after($('<img>').attr('src', this.toDataURL()));
                                $(this).remove();
                            });
                            //promiseArray存储同步器
                            var promiseArray = [];
                            var echartsArray = $('div[_echarts_instance_]');
                            for (var i = 0; i < echartsArray.length; i++) {
                                promiseArray.push(mergeCanvas(echartsArray.eq(i)));
                            }
                            //Promise.all等待所有同步器执行完成
                            Promise.all(promiseArray).then(function () {
                                $('link').remove();
                                $('h1').removeClass();
                                $('h2').removeClass().removeAttr('title');
                                $('h3').removeClass();
                                $('h4').removeClass();
                                var html = $('body').html();
                                // 去掉显示的遮罩
                                var isStart = false, num = 0;
                                for (var i = html.length; i > 0; i--) {
                                    if (!isStart && html.charAt(i) == '>') {
                                        isStart = true;
                                    } else if (isStart && html.charAt(i) == '<') {
                                        isStart = false;
                                        num += 1;
                                    }
                                    if (num == 2) {
                                        html = html.substring(0, i);
                                        break;
                                    }
                                }
                                html = '<body>' + html + "</body>";
                                html = html.replace(/<img(.*?)>/g, '<ig$1>').replace(/<\/img>/g, '</ig>')

                                TempoUtils.downLoadFile({
                                    url: contextPath + "/api/ai/mine/downloadInsight",
                                    data: {
                                        html: TempoMineUtils.encodeParams(html),
                                        width: 1200
                                    },
                                    iframeSrc: 'about:blank',
                                    callback: function () {
                                        window.location.reload();
                                    }
                                });
                            });
                        });
                        if (mask) {
                            mask.tempoprogressbar('close');
                        }
                    },
                    expandable: false
                });


                var descDiv = $('<div id="tempo-mine-summary-desc">');
                summaryPanel.accordionpanel('addContent', descDiv);
                summaryPanel.find('.accordionpanel-header-link').hide();
                var descData = insightData.desc;
                descData.PNAME = result.PNAME;
                descData.THEMENAME = result.THEMENAME;
                rendOverViewDesc(descDiv, descData);
                var flowDiv = $('<div id="tempo-mine-summary-flow">').css('overflow-x', 'hidden');
                summaryPanel.accordionpanel('addContent', flowDiv);
                loadInputdata(flowid, flowDiv, flowDiv, cacheFlowData, true, capture);
            }
        });
    }


    /**
     * 处理一个chart图由多个canvas组成 特殊处理 合并img成
     * @param echart 单个echarts对象div
     * @returns {Promise<T>} 线程同步
     * author：limy luotao
     * code：（内）66482
     */
    var mergeCanvas = function (echart) {
        return new Promise(function (resolve, reject) {
            var canvas = document.createElement("canvas");
            var imgTemp = document.createElement("img");
            canvas.width = echart.width();
            canvas.height = echart.height();
            imgTemp.width = echart.width();
            imgTemp.height = echart.height();
            var context = canvas.getContext("2d");
            context.rect(0, 0, canvas.width, canvas.height);
            context.fillStyle = "#fff";
            context.fill();
            //遍历img 进行合并
            var imgLen = echart.find('img').length;
            echart.find('img').each(function (index, value) {
                //判断img是否为最后一张
                if (index == imgLen - 1) {
                    //value为img的js对象  onload加载img对象
                    value.onload = function () {
                        context.drawImage(value, 0, 0, echart.width(), echart.height());
                        var base64 = canvas.toDataURL("image/png");
                        imgTemp.setAttribute('src', base64);
                        resolve([imgTemp, echart]);
                    }
                } else {
                    value.onload = function () {
                        context.drawImage(value, 0, 0, echart.width(), echart.height());
                    }
                }
            });
        }).then(function (value) {
            var imgParentDiv = $(value[1]).find('img').eq(0).parent();
            imgParentDiv.empty();
            $(value[0]).appendTo(imgParentDiv);
        });
    };

    /**
     * 导出word之前对某些元素做特殊处理
     */
    var updateHtml = function () {
        //贝叶斯网络分类节点图标在导出word不显示
        for (var i = 0; i < $('.mine-classification-bayesnet-model-info').length; i++) {
            $($('.mine-classification-bayesnet-model-info')[i]).find('text').each(function (e) {
                //导出word之前把这个tableStr元素删除掉，会影响svg绘图
                $(this).removeAttr("tableStr");
            });
        }
        //分类评估节点k-s曲线图标不显示问题修改
        for (var i = 0; i < $('.tempo-mine-eval-classification-evalclassficationOther').length; i++) {
            $($('.tempo-mine-eval-classification-evalclassficationOther')[i]).find('textPath').each(function (e) {
                var svg = $(this).parent().parent();
                //绘制一个新的textPath
                $('<g transform="translate(295,125)">' +
                    '<text fill="black" x="145" y="0" dy="1.4em" text-anchor="end" font-size="14">' + $(this).text() + '</text></g>').appendTo(svg);
                $(this).remove();
            });
        }
        //条线图节点条线图导出wordX轴图例问题处理
        for (var i = 0; i < $('.tempo-mine-histoline-insight-div').length; i++) {
            $($('.tempo-mine-histoline-insight-div')[i]).find(".y2LabelText").each(function (e) {
                //修改图例右边距
                $(this).attr("x", "475px");
            });
        }
        //处理统计页面表格导出word之后超出边界的问题61488
        for (var i = 0; i < $('td').length; i++) {
            if ($($('td')[i]).children().length == 0) {
                var text = $($('td')[i]).text();
                //每10个字符进行换行
                if (text.length > 10) {
                    $($('td')[i]).text(text.replace(/(.{10})/g, "$1\r\n"));
                }
            }
        }
    }


    var getBase64Image = function (img) {
        var canvas = document.createElement("canvas");
        canvas.width = img.width;
        canvas.height = img.height;

        var ctx = canvas.getContext("2d");
        ctx.drawImage(img, 0, 0, img.width, img.height);
        var ext = img.src.substring(img.src.lastIndexOf(".") + 1).toLowerCase();
        var dataURL = canvas.toDataURL("image/" + ext);
        return dataURL;
    }
    var imageUrlToBase64 = function (imgs, i, callback) {
        if (imgs && imgs.size() > 0 && imgs.size() > i) {
            var img = imgs.get(i);
            var image = new Image();
            image.src = img.src;
            image.onload = function () {
                var base64 = getBase64Image(img);
                img.src = base64;
                imageUrlToBase64(imgs, i + 1, callback)
            }
            image.onerror = function (event) {
                imageUrlToBase64(imgs, i + 1, callback)
            }
        } else {
            if (callback && $.isFunction(callback)) {
                callback()
            }
        }
    }

    /**
     * 输入、过程、结果
     */
    var loadNodeInsight = function (filterCondition, portsArray, title) {
        var process = function (insightResult) {
            if (insightResult) {
                //cateNodes(insightResult);
                var result = cateNodes(insightResult, filterCondition, portsArray);
                showNodeInsight(result, filterCondition, title);
            }
        }
        if (insightCache[flowid]) {
            process(insightCache[flowid]);
        } else {
            postInsight({
                url: contextPath + "/api/ai/mine/searchInsightInfo",
                data: {
                    flowId: flowid,
                    exeId: exeId,
                },
                type: 'post',
                async: false,
                success: function (insightResult) {
                    if (insightResult && insightResult.success != undefined) {
                        insightResult = insightResult.data;
                    }
                    var needUseResult = [];
                    var needUseResultMap = {};
                    if (connections && connections.length) {
                        for (var i = 0; i < connections.length; i++) {
                            for (var j = 0; j < insightResult.length; j++) {
                                if (connections[i].from_op == insightResult[j].nodeId && !needUseResultMap[insightResult[j].id]) {
                                    needUseResult.push(insightResult[j]);
                                    needUseResultMap[insightResult[j].id] = true;
                                }
                            }
                        }
                    } else {
                        needUseResult = insightResult
                    }
                    insightCache[flowid] = needUseResult;
                    process(needUseResult);
                }
            });
        }
    }

    /**
     * 隐藏多余的节点名称
     * @param nodeInfo 当前节点数据
     * @param h2 当前节点名称元素
     */
    var hideSurplusNodeName = function (nodeInfo, h2) {
        var nodeLists = ["orderenvelope", "signalholographic2d", "signalsimilarity","signaltodata"];
        if (nodeLists.indexOf(nodeInfo.nodeConfigId) > -1) {
            if (oView.find(".node-header[title='" + nodeInfo.nodeLabel + "']").length > 1) {
                h2.hide();
            }
        }
    }

    var showNodeInsight = function (nodes, filterCondition, title) {

        if ((nodes && nodes.length > 0)) {
            $('<h1>').appendTo(oView).addClass('accordionpanel-header').text(title);
            for (var m = 0; m < nodes.length; m++) {
                var insightResItem = nodes[m];
                var filterNode = nodenoteBookMap[insightResItem.nodeId];
                var h2 = $('<h2>').appendTo(oView).attr('title', nodes[m].nodeLabel).text(nodes[m].nodeLabel).addClass('node-header');
                //判断隐藏多余的节点名称
                hideSurplusNodeName(nodes[m], h2);
                if (filterNode != undefined && filterNode.length > 0) {
                    for (var i = 0; i < filterNode.length; i++) {
                        var h3 = $('<h3>').appendTo(oView).addClass("port-header").text("注释");
                        var h3_p = $("<p style='word-break: break-all;'>").appendTo(oView).text(filterNode[i]);
                        hideSurplusNodeName(nodes[m], h3);
                        hideSurplusNodeName(nodes[m], h3_p);
                    }
                    //delete filterNode[insightResItem.nodeId];
                }
                var portType = insightResItem.portType;
                if (portType == null || portType == "" || portType == undefined) {
                    var info = insightResItem.info;
                    if (info != null && info != "" && info != undefined) {
                        portType = JSON.parse(info).portType;
                    }
                }
                showPortInsight(portType, insightResItem, processTypes.indexOf(filterCondition) > -1 || filterCondition == 'result');
            }
            // if(filterNode != undefined){
            // 	var keySets = Object.keys(filterNode);
            // 	for(var i=0;i<keySets.length ;i++){
            // 		$('<h2>').appendTo(oView).attr('title', filterNode[keySets[i]].nodeName).text(filterNode[keySets[i]].nodeName).addClass('node-header');
            // 		$('<h3>').appendTo(oView).addClass("port-header").text("注释");
            // 		$('<p>').appendTo(oView).text(filterNode[keySets[i]].content);
            // 	}
            // }
        }
    }

    var showPortInsight = function (portType, insightResItem, isProcess) {
        if (insightResItem.portChildren) {
            if (isNecessaryDescNode(insightResItem)) {
                showPortView(portType, insightResItem);
            }
            var children = insightResItem.portChildren;
            //去掉节点下重复的子节点
            var newChilden = [];
            var idSet = new Set();
            for (var i = 0; i < children.length; i++) {
                var node = children[i];
                if (idSet.has(node.id)) {
                } else {
                    newChilden.push(node);
                    idSet.add(node.id);
                }
            }
            for (var i = 0; i < newChilden.length; i++) {
                var node = newChilden[i];
                showPortInsight(node.portType, node, isProcess);
            }
        } else {
            showPortView(portType, insightResItem, isProcess);
        }
    }

    var showPortView = function (portType, insightResItem, isProcess) {

        if (!portType) {
            return;
        }
        var container = $('<div>').appendTo(oView).addClass('portContainer');
        if (TempoMineUtils.isDataSet(portType)) {
            if (!isProcess) {
                /**
                 * 文本相似度节点数据集结果集都走分支
                 */
                if (insightResItem.nodeConfigId == 'textsimilarity') {
                    var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);

                    var containerItem = $('<div>').appendTo(container).addClass('portContainerItem');
                    containerItem.append($("<h3>").text((insightResItem.subProcessNodeId ? insightResItem.nodeLabel : '') + insightResItem.portLabel).addClass('port-header'));
                    getPortInsight(insightResItem.id, function (insightInfo) {
                        $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[window.constant.MNODES][insightResItem.nodeConfigId].datasetInsightPage,
                            containerItem, insightResItem.nodeId, {
                                parameters: paramsConfig,
                                source: containerItem,
                                insight: insightInfo,
                                nodeId: insightResItem.nodeId
                            });
                    })
                    return;
                }
                if (insightResItem.nodeConfigId == 'ner') {
                    var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
                    var containerItem = $('<div>').appendTo(container).addClass('portContainerItem');
                    containerItem.append($("<h3>").text((insightResItem.subProcessNodeId ? insightResItem.nodeLabel : '') + TempoUtils.locale("mine.mine_dataset")).addClass('port-header'));
                    getPortInsight(insightResItem.id, function (insightInfo) {
                        $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[window.constant.MNODES][insightResItem.nodeConfigId].datasetInsightPage,
                            containerItem, insightResItem.nodeId, {
                                parameters: paramsConfig,
                                source: containerItem,
                                insight: insightInfo,
                                nodeId: insightResItem.nodeId
                            });
                    })
                    return;
                }
                if (window[insightResItem.type][insightResItem.nodeConfigId] && window[insightResItem.type][insightResItem.nodeConfigId].datasetInsightExportPage) {
                    var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
                    $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightResItem.type][insightResItem.nodeConfigId].datasetInsightExportPage,
                        container, insightResItem.nodeId, {
                            parameters: paramsConfig,
                            source: container,
                            insight: insightResItem,
                            nodeId: insightResItem.nodeId
                        });
                }

                if (window[insightResItem.type][insightResItem.nodeConfigId] && window[insightResItem.type][insightResItem.nodeConfigId].propertyPageExport) {
                    var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
                    var propertyPageExport = window[insightResItem.type][insightResItem.nodeConfigId].propertyPageExport;
                    $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightResItem.type][insightResItem.nodeConfigId].propertyPageExport,
                        container, insightResItem.nodeId, {
                            parameters: paramsConfig,
                            source: container,
                            insight: insightResItem,
                            nodeId: insightResItem.nodeId
                        });
                }

                var containerItem = $('<div>').appendTo(container).addClass('portContainerItem');
                //数据集
                containerItem.append($("<h3>").text((insightResItem.subProcessNodeId ? insightResItem.nodeLabel : '') + insightResItem.portLabel).addClass('port-header'));
                //输出数据
                containerItem.append($("<h4>").text((insightResItem.subProcessNodeId ? insightResItem.nodeLabel : '') + TempoUtils.locale("mine.originalData")).addClass('accordionpanel-header'));
                getPortInsight(insightResItem.id, function (insightInfo) {
                    //	createResTable(insightInfo.resultTableData,containerItem);
                    if (insightResItem.type == "dm_textminging") {
                        if (insightResItem.nodeConfigId == "textTF") {
                            getPortInsight(insightResItem.id, function (insightInfo) {
                                var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
                                paramsConfig.nodeId = insightResItem.nodeId;
                                if (datalength == 0 || datalength != "") {
                                    datalength = Number(datalength);
                                    var dlength = insightInfo.rsTableData.length - 2;
                                    if (insightInfo.rsTableData.length == 103) {
                                        dlength--;
                                    }
                                    if (datalength < dlength) {
                                        insightInfo.rsTableData.splice(datalength + 2, dlength - datalength)
                                        //获取到表格列数
                                        var resultLength = insightInfo.rsTableData[insightInfo.rsTableData.length - 1].length;
                                        var flag = true;
                                        //构造最后一行的省略号
                                        var endList = [];
                                        for (var i = 0; i < resultLength; i++) {
                                            endList.push("...");
                                        }
                                        //判断若当前表格数据中已有省略号则不增加省略号
                                        if (resultLength > 0 && insightInfo.rsTableData[insightInfo.rsTableData.length - 1][0] != "...") {
                                            insightInfo.rsTableData.push(endList);
                                        }
                                    }
                                    var dlength1 = insightInfo.resultDataset.length - 2;
                                    if (insightInfo.resultDataset.length == 103) {
                                        dlength1--;
                                    }
                                    if(datalength < dlength1){
                                        insightInfo.resultDataset.splice(datalength + 2, dlength1 - datalength)
                                        //获取到表格列数
                                        var resultLength = insightInfo.resultDataset[insightInfo.resultDataset.length - 1].length;
                                        var flag = true;
                                        //构造最后一行的省略号
                                        var endList = [];
                                        for (var i = 0; i < resultLength; i++) {
                                            endList.push("...");
                                        }
                                        //判断若当前表格数据中已有省略号则不增加省略号
                                        if (resultLength > 0 && insightInfo.resultDataset[insightInfo.resultDataset.length - 1][0] != "...") {
                                            insightInfo.resultDataset.push(endList);
                                        }
                                    }

                                }
                                $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightInfo.type][insightInfo.nodeConfigId].datasetInsightPage,
                                    container, insightResItem.nodeId, {
                                        parameters: paramsConfig,
                                        source: container,
                                        insight: insightInfo,
                                        pageParser: pageParser,
                                        nodeId: insightResItem.nodeId
                                    });
                            })
                        } else {
                            if("vsm" == insightInfo.nodeConfigId){
                                var datasetData1 = insightInfo.resultDataset;
                                var datasetData = [];
                                if (datasetData1 && datasetData1.length > 0) {
                                    var lineData = datasetData1[0];
                                    // 如果输出数据列超过17列，则只显示前后8列数据，中间用...显示
                                    if (lineData && lineData.length > 17) {
                                        for (var i = 0; i < datasetData1.length; i++) {
                                            var rowData = datasetData1[i];
                                            var newRowData = rowData.slice(0, 8);
                                            newRowData.push("...");
                                            newRowData = newRowData.concat(rowData.slice(-8));
                                            datasetData.push(newRowData);
                                        }
                                    } else {
                                        datasetData = datasetData1;
                                    }
                                }else{
                                    datasetData = datasetData1;
                                }
                                insightInfo.resultDataset = datasetData;
                            }else if (datalength == 0 || datalength != "") {
                                datalength = Number(datalength);
                                var dlength = insightInfo.resultDataset.length - 2;
                                if (insightInfo.resultDataset.length == 103) {
                                    dlength--;
                                }
                                if (datalength < dlength) {
                                    insightInfo.resultDataset.splice(datalength + 2, dlength - datalength);
                                    //获取到表格列数
                                    var resultLength = insightInfo.resultDataset[insightInfo.resultDataset.length - 1].length;
                                    var flag = true;
                                    //构造最后一行的省略号
                                    var endList = [];
                                    for (var i = 0; i < resultLength; i++) {
                                        endList.push("...");
                                    }
                                    //判断若当前表格数据中已有省略号则不增加省略号
                                    if (resultLength > 0 && insightInfo.resultDataset[insightInfo.resultDataset.length - 1][0] != "...") {
                                        insightInfo.resultDataset.push(endList);
                                    }
                                }
                            }
                            TempoMineInsightUtils.createWordMingingDatasetTable(insightInfo, containerItem)
                        }
                        //	createResTable(insightInfo,containerItem);
                    } else {
                        if (insightResItem.nodeConfigId == "canonicalcorr") {
                            for (var x = 0; x < insightInfo.resultTableData.length; x++) {
                                var elem = insightInfo.resultTableData[x];
                                for (var y = 0; y < elem.length; y++) {
                                    if (elem[y] == "Eigenvalue" || elem[y] == "Proportion" || elem[y] == "Cumulation" || elem[y].indexOf("_correlation_coefficient") != -1) {
                                        var newelem = TempoUtils.locale("canonicalcorr." + elem[y]);
                                        insightInfo.resultTableData[x][y] = newelem;
                                    }
                                }
                            }
                        } else if (insightResItem.nodeConfigId == "anova") {
                            for (var x = 0; x < insightInfo.resultTableData.length; x++) {
                                var elem = insightInfo.resultTableData[x];
                                for (var y = 0; y < elem.length; y++) {
                                    if (elem[y] == "df" || elem[y] == "Sum_of_squares" || elem[y] == "Mean_square" || elem[y] == "F" || elem[y] == "sig") {
                                        var newelem = TempoUtils.locale("anova." + elem[y]);
                                        insightInfo.resultTableData[x][y] = newelem;
                                    }
                                }
                            }
                        }
                        if (insightResItem.nodeConfigId == "factor") {
                            for (var x = 0; x < insightInfo.resultTableData.length; x++) {
                                var elem = insightInfo.resultTableData[x];
                                if ($.isArray(elem)) {
                                    var lastIdx = elem.length - 1;
                                    var lastColumns = elem[lastIdx];
                                    if ($.isArray(lastColumns)) {
                                        lastColumns = $.map(lastColumns, function (val) {
                                            data_factor = TempoMineUtils.format(val);
                                            insightInfo.resultTableData[x][lastIdx] = data_factor;
                                        });
                                    }
                                }
                            }

                        }
                        if (datalength == 0 || datalength != "") {
                            //通过导出word的数据长度datalength控制数据集表格行数
                            spliceResultTableDataByDataLength(insightInfo);
                        }
                        createResTable(insightInfo, containerItem);
                    }

                })

                if (insightResItem.type != "dm_textminging") {
                    var insightInfo = JSON.parse(insightResItem.info);
                    if (insightInfo.isShowStatisticData || insightInfo.showStatisticData) {
                        var containerItem2 = $('<div>').appendTo(container).addClass('portContainerItem');
                        //统计信息
                        containerItem2.append($("<h4>").text((insightResItem.subProcessNodeId ? insightResItem.nodeLabel : '') + TempoUtils.locale("mine.originalDataStatisticsInfo")).addClass('accordionpanel-header'))
                        getPortInsight(insightResItem.id, function (insightInfo) {
                            //通过导出word的数据长度datalength控制数据集表格行数
                            spliceResultTableDataByDataLength(insightInfo);
                            createResTableInfo1(insightInfo, containerItem2, dataResultType.proceduce);
                        })
                    }
                }
            } else if (insightResItem.nodeType == "textmining") {
                container.append($("<h3>").text((insightResItem.subProcessNodeId ? insightResItem.nodeLabel : '') + insightResItem.portLabel).addClass('port-header'))

                //初始化算法参数界面
                var pageParser = function (parent) {
                    return {
                        init: function (param) {
                            param = param || {};
                            var values = param.values || {};
                            TempoUtils.parserUi(parent, values, $.noop);
                        }
                    }
                }
                getPortInsight(insightResItem.id, function (insightInfo) {
                    var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
                    $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightInfo.type][insightInfo.nodeConfigId].datasetInsightExportPage || window[insightInfo.type][insightInfo.nodeConfigId].datasetInsightPage,
                        container, insightResItem.nodeId, {
                            parameters: paramsConfig,
                            source: container,
                            insight: insightInfo,
                            pageParser: pageParser,
                            nodeId: insightResItem.nodeId
                        });
                })
            } else {
                var datasetLabel = $("<h3>").text((insightResItem.subProcessNodeId ? insightResItem.nodeLabel : '') + insightResItem.portLabel).addClass('port-header').appendTo(container);
                var insightId = insightResItem.id;
                getPortInsight(insightId, function (insightInfo) {
                    if (insightInfo.nodeConfigId == "apriori" && insightInfo.cycleLabel) {
                        datasetLabel.text(datasetLabel.text() + "(" + insightInfo.cycleLabel + ")");
                    }
                    var inputPanel = $('<div>').appendTo(container).accordionpanel({
                        expanded: true,
                        title: TempoUtils.locale("mine.originalData")
                    });
                    //通过导出word的数据长度datalength控制数据集表格行数
                    spliceResultTableDataByDataLength(insightInfo);
                    createResTable(insightInfo, inputPanel.accordionpanel('getContent'));
                    var insightInfo = JSON.parse(insightResItem.info);
                    if (insightInfo.isShowStatisticData || insightInfo.showStatisticData) {
                        var sumPanel = $('<div>').appendTo(container).accordionpanel({
                            expanded: true,
                            title: TempoUtils.locale("mine.originalDataStatisticsInfo")
                        });
                        //通过导出word的数据长度datalength控制数据集表格行数
                        spliceResultTableDataByDataLength(insightInfo);
                        createResTableInfo1(insightInfo, sumPanel.accordionpanel('getContent'), dataResultType.proceduce);
                    }
                })
            }

        } else if (TempoMineUtils.isModel(portType)) {
            //将算法评估节点导出word里面展示的为最佳模型修改为模型
            if(insightResItem.portLabel == "最佳模型"){
                insightResItem.portLabel = "模型"
            }
            var modelLabel = $("<h3>").text((insightResItem.subProcessNodeId ? insightResItem.nodeLabel : '') + insightResItem.portLabel).addClass('port-header').appendTo(container);
            //初始化算法参数界面
            var pageParser = function (parent) {
                return {
                    init: function (param) {
                        param = param || {};
                        var values = param.values || {};
                        TempoUtils.parserUi(parent, values, $.noop);
                    }
                }
            }
            if (insightResItem.nodeConfigId == "normalizeddata") {
                var insightInfo = JSON.parse(insightResItem.info);
                var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId)
                getPortInsight(insightResItem.id, function (insightInfo) {
                    $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightInfo.type][insightInfo.nodeConfigId].frameInsightPage,
                        container, insightResItem.nodeId, {
                            source: container,
                            parameters: paramsConfig,
                            insight: insightInfo
                        });
                })
            }
            getPortInsight(insightResItem.id, function (insightInfo) {
                var configParentDiv = $('<div class="tempo-mine-alg-config-page">').appendTo(container);

                if (insightInfo.type == "dm_featureeng" || insightInfo.type == "dm_statistics") {
                    if (insightInfo.nodeConfigId == "variableselection") {
                        $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightInfo.type][insightInfo.nodeConfigId].frameInsightPage,
                            container, insightResItem.nodeId, {source: container, insight: insightInfo});
                    } else if (insightInfo.nodeConfigId == "featurecode") {
                        getPortInsight(insightResItem.id, function (insightInfo) {
                            $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightInfo.type][insightInfo.nodeConfigId].frameInsightPage,
                                container, insightResItem.nodeId, {
                                    source: container,
                                    parameters: paramsConfig,
                                    insight: insightInfo
                                });
                        })
                    } else if(insightResItem.nodeConfigId == "pca"){
                        var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
                        getPortInsight(insightResItem.id, function (insightInfo) {
                            $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightInfo.type][insightInfo.nodeConfigId].pcaInsightExport,
                                container, insightResItem.nodeId, {
                                    source: container,
                                    insight: insightInfo,
                                    parameters: paramsConfig
                                });
                        })
                    } else if (insightInfo.nodeConfigId != "descriptivestatistics" && insightInfo.nodeConfigId != "correlationcoefficient") {
                        getPortInsight(insightResItem.id, function (insightInfo) {
                            $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightInfo.type][insightInfo.nodeConfigId].datasetInsightPage,
                                container, insightResItem.nodeId, {
                                    source: container,
                                    parameters: paramsConfig,
                                    insight: insightInfo
                                });
                        })
                    }
                } else if (insightInfo.type == "dm_textminging" || insightInfo.type == "dm_autolearning" || insightInfo.type == "dm_deeplearning" || insightInfo.type == "dm_integratedlearning") {
                    if (insightInfo.producerNodeTypeId && (insightInfo.producerNodeTypeId == "votingclassify" || insightInfo.producerNodeTypeId == "votingreg")) {
                        var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId)
                        getPortInsight(insightResItem.id, function (insightInfo) {
                            $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightInfo.type][insightInfo.producerNodeTypeId].modelPageExport,
                                container, insightResItem.nodeId, {
                                    source: container,
                                    parameters: paramsConfig,
                                    insight: insightInfo
                                });
                        })
                    } else if (insightInfo.producerNodeTypeId && (insightInfo.producerNodeTypeId == "regressiondnn" || insightInfo.producerNodeTypeId == "lstm" || insightInfo.producerNodeTypeId == "classificationdnn" || insightInfo.producerNodeTypeId == "rnnclassify")) {
                        var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId)
                        var thisNode = insightResItem.nodeConfigId;
                        if (!paramsConfig) {
                            if (!MineFlowInfo.getParameters(insightInfo.subProcessNodeId)) {
                                container.remove();
                                return;
                            }
                            paramsConfig = MineFlowInfo.getParameters(insightInfo.subProcessNodeId).argsTempList[thisNode].data.parameters;
                        }
                        getPortInsight(insightResItem.id, function (insightInfo) {
                            $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightInfo.type][insightInfo.nodeConfigId].propertyPageExport,
                                container, insightResItem.nodeId, {
                                    source: container,
                                    parameters: paramsConfig,
                                    insight: insightInfo
                                });
                        })
                        var page = window[insightInfo.type][insightInfo.nodeConfigId].frameInsightExportPage || window[insightInfo.type][insightInfo.nodeConfigId].frameInsightPage;
                        if (MineFlowInfo.getParameters(insightResItem.nodeId)) {
                            $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + page, container, insightResItem.nodeId, {
                                source: container,
                                insight: insightInfo,
                                parameters: paramsConfig,
                                dialog: pageParser(container)
                            });
                        }
                    } else if (insightInfo.nodeConfigId == "autoclustering") {
                        showClusterResPic1(insightInfo, container, "auto");
                    } else if (window[insightInfo.type][insightInfo.nodeConfigId] && window[insightInfo.type][insightInfo.nodeConfigId].frameInsightPage) {
                        var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
                        // 如果有导出word洞察页面，就使用导出word洞察页面，没有则使用设计区的洞察页面
                        var page = window[window.constant.MNODES][insightInfo.nodeConfigId].frameInsightExportPage || window[window.constant.MNODES][insightInfo.nodeConfigId].frameInsightPage;
                        getPortInsight(insightResItem.id, function (insightInfo) {
                            $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + page,
                                container, insightResItem.nodeId, {
                                    source: container,
                                    parameters: paramsConfig,
                                    insight: insightInfo
                                });
                        })
                    } else if (window[window.constant.MNODES][insightInfo.nodeConfigId] && window[window.constant.MNODES][insightInfo.nodeConfigId].frameInsightPage) {
                        var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId)
                        getPortInsight(insightResItem.id, function (insightInfo) {
                            $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[window.constant.MNODES][insightInfo.nodeConfigId].frameInsightPage,
                                container, insightResItem.nodeId, {
                                    source: container,
                                    parameters: paramsConfig,
                                    insight: insightInfo
                                });
                        })
                    }
                } else if (insightInfo.type == 'datamine') {
                    var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
                    if (!paramsConfig) {
                        var thisNode = insightResItem.nodeConfigId;
                        if (!MineFlowInfo.getParameters(insightInfo.subProcessNodeId)) {
                            container.remove();
                            return;
                        }
                        paramsConfig = MineFlowInfo.getParameters(insightInfo.subProcessNodeId).argsTempList[thisNode].data.parameters;
                    }
                    //兼容历史
                    if (insightInfo.producerNodeTypeId && (insightInfo.producerNodeTypeId == "regressiondnn" || insightInfo.producerNodeTypeId == "classificationdnn")) {
                        getPortInsight(insightResItem.id, function (insightInfo) {
                            $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[window.constant.DATAMINE_DEEPLEARNING][insightInfo.nodeConfigId].propertyPageExport,
                                container, insightResItem.nodeId, {
                                    source: container,
                                    parameters: paramsConfig,
                                    insight: insightInfo
                                });
                        })
                        var page = window[window.constant.DATAMINE_DEEPLEARNING][insightInfo.nodeConfigId].frameInsightExportPage || window[window.constant.DATAMINE_DEEPLEARNING][insightInfo.nodeConfigId].frameInsightPage;
                        if (MineFlowInfo.getParameters(insightResItem.nodeId)) {
                            $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + page, container, insightResItem.nodeId, {
                                source: container,
                                insight: insightInfo,
                                parameters: paramsConfig,
                                dialog: pageParser(container)
                            });
                        }
                    } else {
                        if (insightInfo.nodeConfigId == "apriori" && insightInfo.cycleLabel) {
                            modelLabel.text(modelLabel.text() + "(" + insightInfo.cycleLabel + ")");
                        }
                        var propertyPageExport = window[insightInfo.type][insightInfo.nodeConfigId].propertyPageExport;
                        if (propertyPageExport) {
                            $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + propertyPageExport,
                                configParentDiv, insightResItem.nodeId, {
                                    source: configParentDiv,
                                    data: {parameters: paramsConfig, formEditable: false, algNodeIsHidden: true},
                                    dialog: pageParser(configParentDiv)
                                });
                        } else {
                            $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightInfo.type][insightInfo.nodeConfigId].frameInsightPage,
                                configParentDiv, insightResItem.nodeId, {
                                    source: configParentDiv,
                                    data: {parameters: paramsConfig, formEditable: false, algNodeIsHidden: true},
                                    dialog: pageParser(configParentDiv)
                                });
                        }
                    }
                } else if (insightInfo.type == 'dm_control') {
                    var algNodeInsightInfo = insightInfo.algNodeModelInsightInfo;
                    if (typeof algNodeInsightInfo == "string") {
                        algNodeInsightInfo = JSON.parse(algNodeInsightInfo);
                    }
                    if(algNodeInsightInfo == undefined){
                        algNodeInsightInfo = insightInfo;
                    }
                    if (algNodeInsightInfo.producerNodeCategory == undefined && algNodeInsightInfo.algNodeModelInsightInfo && typeof algNodeInsightInfo.algNodeModelInsightInfo == "string") {
                        algNodeInsightInfo = JSON.parse(algNodeInsightInfo.algNodeModelInsightInfo)
                    }
                    // var algParamsConfig = MineFlowInfo.getParameters(algNodeInsightInfo.producerNodeId);
                    // if(algNodeInsightInfo.nodeConfigId == "scorecard" || algNodeInsightInfo.nodeConfigId == "psi"){
                    // 	$m.loadHtmlSyn(contextPath+'/api/ai/mine/'+ window[algNodeInsightInfo.type][algNodeInsightInfo.producerNodeTypeId].propertyPage,
                    // 		configParentDiv, algNodeInsightInfo.producerNodeId, {source:configParentDiv,insight:algNodeInsightInfo,data:{ parameters:algParamsConfig, formEditable:false,algNodeIsHidden:true}, dialog: pageParser(configParentDiv)});
                    // }else{
                    // 	$m.loadHtmlSyn(contextPath+'/api/ai/mine/'+ window['datamine'][algNodeInsightInfo.producerNodeTypeId].propertyPage,
                    // 		configParentDiv, algNodeInsightInfo.producerNodeId, {source:configParentDiv,insight:algNodeInsightInfo,data:{ parameters:algParamsConfig, formEditable:false,algNodeIsHidden:true}, dialog: pageParser(configParentDiv)});
                    // }
                    var algNodeConfig = algNodeInsightInfo.producerNodeCategory;
                    var nodeConfigId = algNodeInsightInfo.producerNodeTypeId;
                    if (nodeConfigId == "svd" || nodeConfigId == "pca" || nodeConfigId == "factor" || nodeConfigId == "binning") {
                        var page = window[window.constant.MNODES][algNodeInsightInfo.producerNodeTypeId].datasetInsightPage
                        $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + page, container, algNodeInsightInfo.producerNodeId, {
                            source: container,
                            insight: algNodeInsightInfo,
                            dialog: pageParser(container)
                        });

                    } else if (algNodeConfig == 'clustering') {
                        var page = window['datamine'][algNodeInsightInfo.producerNodeTypeId].frameInsightExportPage || window['datamine'][algNodeInsightInfo.producerNodeTypeId].frameInsightPage;
                        if (page) {
                            var paramsConfig = MineFlowInfo.getParameters(algNodeInsightInfo.producerNodeId);
                            if (paramsConfig) {
                                var clusterNodeInsightDiv = $("<div/>").appendTo(container);
                                $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + page,
                                    clusterNodeInsightDiv, algNodeInsightInfo.producerNodeId, {
                                        source: clusterNodeInsightDiv,
                                        insight: algNodeInsightInfo,
                                        parameters: paramsConfig,
                                        dialog: pageParser(clusterNodeInsightDiv)
                                    });
                            }
                        }
                        showClusterRes(algNodeInsightInfo, container);
                    } else if (nodeConfigId == 'bagging' || nodeConfigId == 'regressionBagging') {
                        var paramsConfig = MineFlowInfo.getParameters(algNodeInsightInfo.producerNodeId);
                        $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window['datamine'][algNodeInsightInfo.producerNodeTypeId].frameInsightExportPage, container, algNodeInsightInfo.producerNodeId, {
                            source: container,
                            parameters: paramsConfig,
                            insight: algNodeInsightInfo,
                            dialog: pageParser(container)
                        });
                    } else if (nodeConfigId == "ahp" || nodeConfigId == "fce") {
                        var paramsConfig = MineFlowInfo.getParameters(algNodeInsightInfo.producerNodeId);
                        var page = window[window.constant.MNODES][algNodeInsightInfo.producerNodeTypeId].frameInsightPage
                        $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + page, container, algNodeInsightInfo.producerNodeId, {
                            source: container,
                            insight: algNodeInsightInfo,
                            parameters: paramsConfig,
                            dialog: pageParser(container)
                        });
                    } else if (nodeConfigId == "vsm") {

                        var paramsConfig = MineFlowInfo.getParameters(algNodeInsightInfo.producerNodeId);
                        var page = window[window.constant.MNODES][algNodeInsightInfo.producerNodeTypeId].frameInsightPage;
                        $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + page, container, algNodeInsightInfo.producerNodeId, {
                            source: container,
                            insight: algNodeInsightInfo,
                            parameters: paramsConfig,
                            dialog: pageParser(container)
                        });
                    } else if (insightInfo.producerNodeId == "readpythonmodel") {
                        var paramsConfig = MineFlowInfo.getParameters(insightInfo.producerNodeId);
                        $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[window.constant.MNODES][insightInfo.producerNodeId].frameInsightPage, container, insightResItem.nodeId, {
                            source: container,
                            insight: insightInfo.algNodeModelInsightInfo,
                            parameters: paramsConfig,
                            dialog: pageParser(container)
                        });
                    } else if(algNodeInsightInfo.algNodeModelInsightInfo && "pmml" == algNodeInsightInfo.algNodeModelInsightInfo.producerNodeCategory){
                        TempoMineInsightUtils.showPMMLModelInsight(algNodeInsightInfo.algNodeModelInsightInfo, container);
                    } else {
                        if (window[window.constant.MNODES][algNodeInsightInfo.producerNodeTypeId] && window[window.constant.MNODES][algNodeInsightInfo.producerNodeTypeId].frameInsightPage) {
                            var paramsConfig = MineFlowInfo.getParameters(algNodeInsightInfo.producerNodeId);
                            var page = window[window.constant.MNODES][algNodeInsightInfo.producerNodeTypeId].frameInsightPage;
                            $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + page, container, algNodeInsightInfo.producerNodeId, {
                                source: container,
                                insight: algNodeInsightInfo,
                                parameters: paramsConfig,
                                dialog: pageParser(container)
                            });
                        }
                    }
                } else if (insightInfo.type == 'dm_model') {
                    if (insightResItem.nodeType == 'model_io') {
                        if (insightResItem.nodeConfigId == "pmmlapplymodel" || insightResItem.nodeConfigId == "readpmmlmodel") {
                            var algNodeInsightInfo = insightInfo.algNodeModelInsightInfo;
                            if (typeof algNodeInsightInfo == "string") {
                                algNodeInsightInfo = JSON.parse(algNodeInsightInfo);
                            }
                            while (algNodeInsightInfo.algNodeModelInsightInfo != null) {
                                algNodeInsightInfo = algNodeInsightInfo.algNodeModelInsightInfo;
                                if (typeof algNodeInsightInfo == "string") {
                                    algNodeInsightInfo = JSON.parse(algNodeInsightInfo);
                                }
                            }
                            TempoMineInsightUtils.showPMMLModelInsight(algNodeInsightInfo, configParentDiv);
                        } else if (insightResItem.nodeConfigId == "applypythonmodel" || insightResItem.nodeConfigId == "readpythonmodel" || insightResItem.nodeConfigId == "writepythonmodel") {
                            var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
                            if (paramsConfig && window[window.constant.MNODES][insightResItem.nodeConfigId].frameInsightPage) {
                                $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[window.constant.MNODES][insightResItem.nodeConfigId].frameInsightPage, container, insightResItem.nodeId, {
                                    source: container,
                                    insight: insightInfo,
                                    parameters: paramsConfig,
                                    dialog: pageParser(container)
                                });
                            }
                        } else {
                            var algNodeInsightInfo = insightInfo.algNodeModelInsightInfo;
                            if (typeof algNodeInsightInfo == "string") {
                                algNodeInsightInfo = JSON.parse(algNodeInsightInfo);
                            }
                            if (algNodeInsightInfo.producerNodeCategory == undefined && algNodeInsightInfo.algNodeModelInsightInfo && typeof algNodeInsightInfo.algNodeModelInsightInfo == "string") {
                                algNodeInsightInfo = JSON.parse(algNodeInsightInfo.algNodeModelInsightInfo)
                            }
                            var algNodeConfig = algNodeInsightInfo.producerNodeCategory;
                            var nodeConfigId = algNodeInsightInfo.producerNodeTypeId;
                            if (nodeConfigId == "svd" || nodeConfigId == "factor" || nodeConfigId == "binning") {
                                var page = window[window.constant.MNODES][algNodeInsightInfo.producerNodeTypeId].datasetInsightPage
                                $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + page, container, algNodeInsightInfo.producerNodeId, {
                                    source: container,
                                    insight: algNodeInsightInfo,
                                    dialog: pageParser(container)
                                });

                            } else if (nodeConfigId == "pca"){
                                var page = window[window.constant.MNODES][algNodeInsightInfo.producerNodeTypeId].pcaInsightExport
                                $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + page, container, algNodeInsightInfo.producerNodeId, {
                                    source: container,
                                    insight: algNodeInsightInfo,
                                    dialog: pageParser(container)
                                });
                            } else if (algNodeConfig == 'clustering') {
                                var page = window['datamine'][algNodeInsightInfo.producerNodeTypeId].frameInsightExportPage || window['datamine'][algNodeInsightInfo.producerNodeTypeId].frameInsightPage;
                                if (page) {
                                    var paramsConfig = MineFlowInfo.getParameters(algNodeInsightInfo.producerNodeId);
                                    if (paramsConfig) {
                                        var clusterNodeInsightDiv = $("<div/>").appendTo(container);
                                        $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + page,
                                            clusterNodeInsightDiv, algNodeInsightInfo.producerNodeId, {
                                                source: clusterNodeInsightDiv,
                                                insight: algNodeInsightInfo,
                                                parameters: paramsConfig,
                                                dialog: pageParser(clusterNodeInsightDiv)
                                            });
                                    }
                                }
                                showClusterRes(algNodeInsightInfo, container);
                            } else if (nodeConfigId == 'bagging' || nodeConfigId == 'regressionBagging') {
                                var paramsConfig = MineFlowInfo.getParameters(algNodeInsightInfo.producerNodeId);
                                $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window['datamine'][algNodeInsightInfo.producerNodeTypeId].frameInsightExportPage, container, algNodeInsightInfo.producerNodeId, {
                                    source: container,
                                    parameters: paramsConfig,
                                    insight: algNodeInsightInfo,
                                    dialog: pageParser(container)
                                });
                            } else if (nodeConfigId == "ahp" || nodeConfigId == "fce") {
                                var paramsConfig = MineFlowInfo.getParameters(algNodeInsightInfo.producerNodeId);
                                var page = window[window.constant.MNODES][algNodeInsightInfo.producerNodeTypeId].frameInsightPage
                                $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + page, container, algNodeInsightInfo.producerNodeId, {
                                    source: container,
                                    insight: algNodeInsightInfo,
                                    parameters: paramsConfig,
                                    dialog: pageParser(container)
                                });
                            } else if (nodeConfigId == "vsm") {

                                var paramsConfig = MineFlowInfo.getParameters(algNodeInsightInfo.producerNodeId);
                                var page = window[window.constant.MNODES][algNodeInsightInfo.producerNodeTypeId].frameInsightPage;
                                $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + page, container, algNodeInsightInfo.producerNodeId, {
                                    source: container,
                                    insight: algNodeInsightInfo,
                                    parameters: paramsConfig,
                                    dialog: pageParser(container)
                                });
                            } else {
                                if (window[window.constant.MNODES][algNodeInsightInfo.producerNodeTypeId] && window[window.constant.MNODES][algNodeInsightInfo.producerNodeTypeId].frameInsightPage) {
                                    if(insightInfo.algNodeModelInsightInfo && "autoclustering" == insightInfo.algNodeModelInsightInfo.producerNodeTypeId){
                                        showClusterResPic1(insightInfo.algNodeModelInsightInfo, container, "auto");
                                    }else {
                                        var paramsConfig = MineFlowInfo.getParameters(algNodeInsightInfo.producerNodeId);
                                        var page = window[window.constant.MNODES][algNodeInsightInfo.producerNodeTypeId].frameInsightPage;
                                        $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + page, container, algNodeInsightInfo.producerNodeId, {
                                            source: container,
                                            insight: algNodeInsightInfo,
                                            parameters: paramsConfig,
                                            dialog: pageParser(container)
                                        });
                                    }
                                }
                            }
                        }
                    }
                }

                // 获取自定义算法标识
                var isUserDefined = insightInfo.isUserDefined;
                // 自定义算法语言类型
                var lang = insightInfo.lang;
                //获取nodeType dm_statistics（注意有可能没拿到）
                if (insightResItem.nodeType == 'clustering') {
                    if (window[insightInfo.type][insightInfo.nodeConfigId].frameInsightPage) {
                        var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
                        if (paramsConfig) {
                            var clusterNodeInsightDiv = $("<div/>").appendTo(container);
                            $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightInfo.type][insightInfo.nodeConfigId].frameInsightPage,
                                clusterNodeInsightDiv, insightResItem.nodeId, {
                                    source: clusterNodeInsightDiv,
                                    insight: insightInfo,
                                    parameters: paramsConfig,
                                    dialog: pageParser(clusterNodeInsightDiv)
                                });
                        }
                    }
                    showClusterRes(insightInfo, container);
                } else if (loadFrameInsightPageTypeArray.indexOf(insightResItem.nodeType) != -1 && insightResItem.nodeConfigId != "automl") {
                    var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
                    var page = window[insightInfo.type][insightInfo.nodeConfigId].frameInsightExportPage || window[insightInfo.type][insightInfo.nodeConfigId].frameInsightPage;
                    //添加中间值，如果为算法评估节点则数据包含在configParentDiv中
                    var parentDiv = "";
                    if(insightResItem.nodeType == "evaluation"){
                        parentDiv = configParentDiv;
                    }else {
                        parentDiv = container;
                    }
                    if (paramsConfig) {
                        $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + page, parentDiv, insightResItem.nodeId, {
                            source: parentDiv,
                            insight: insightInfo,
                            parameters: paramsConfig,
                            dialog: pageParser(parentDiv)
                        });
                    }
                } else if (insightResItem.nodeConfigId == "pythonscript" || (isUserDefined && "python" === lang.toLowerCase())) {
                    var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
                    if (paramsConfig && window[window.constant.MNODES][insightResItem.nodeConfigId].modelInsightPage) {
                        $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[window.constant.MNODES][insightResItem.nodeConfigId].modelInsightPage, container, insightResItem.nodeId, {
                            source: container,
                            insight: insightInfo,
                            parameters: paramsConfig,
                            dialog: pageParser(container)
                        });
                    }
                } else if (insightResItem.nodeConfigId == 'descriptivestatistics' || insightResItem.nodeConfigId == 'correlationcoefficient') {
                    if (window[insightInfo.type][insightInfo.nodeConfigId].frameInsightPage) {
                        var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
                        if (paramsConfig) {
                            var clusterNodeInsightDiv = $("<div/>").appendTo(container);
                            $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightInfo.type][insightInfo.nodeConfigId].frameInsightPage,
                                clusterNodeInsightDiv, insightResItem.nodeId, {
                                    source: clusterNodeInsightDiv,
                                    insight: insightInfo,
                                    parameters: paramsConfig,
                                    dialog: pageParser(clusterNodeInsightDiv)
                                });
                        }
                    }
                }

                // 对模型读取节点进行处理
                if (insightInfo.nodeConfigId === "readmodel") {
                    var algNodeInsightInfo = insightInfo.algNodeModelInsightInfo;
                    if (typeof algNodeInsightInfo == "string") {
                        algNodeInsightInfo = JSON.parse(algNodeInsightInfo);
                    }
                    if (algNodeInsightInfo != null && algNodeInsightInfo.modelName != null && algNodeInsightInfo.modelVersion != null) {
                        // 给模型读取节点的洞察增加模型名称和版本号
                        var tag = "利用的模型名称：" + algNodeInsightInfo.modelName + "；版本号：" + algNodeInsightInfo.modelVersion + "。";
                        var downLoadBtn = "<div style='margin-bottom: 10px'><span'>" + tag + "</span></div>";
                        configParentDiv.prepend(downLoadBtn);
                    }
                }
            })
        } else if (!TempoMineUtils.isNotDefaultPort(portType)) {
            if (insightResItem.type == "dm_stream") {
//				container.append($("<h3>").text((insightResItem.subProcessNodeId ? insightResItem.nodeLabel : '') + insightResItem.portLabel).addClass('port-header'))
                var insightId = insightResItem.id;
                getPortInsight(insightId, function (insightInfo) {
                    var inputPanel = $('<div>').appendTo(container).accordionpanel({
                        expanded: true,
                        title: TempoUtils.locale("mine.originalData")
                    });
                    var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
                    $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[window.constant.DATAMINE_STREAM][insightInfo.nodeConfigId].datasetInsightPage,
                        container, insightResItem.nodeId, {
                            source: container,
                            insight: insightInfo,
                            parameters: paramsConfig
                        });
                    var insightInfo = JSON.parse(insightResItem.info);
                    if (insightInfo.isShowStatisticData || insightInfo.showStatisticData) {
                        var sumPanel = $('<div>').appendTo(container).accordionpanel({
                            expanded: true,
                            title: TempoUtils.locale("mine.originalDataStatisticsInfo")
                        });
                        //通过导出word的数据长度datalength控制数据集表格行数
                        spliceResultTableDataByDataLength(insightInfo);
                        createResTableInfo1(insightInfo, sumPanel.accordionpanel('getContent'), dataResultType.proceduce);
                    }
                })
            } else {
                container.append($("<h3>").text((insightResItem.subProcessNodeId ? insightResItem.nodeLabel : '') + TempoUtils.locale("mine.jiedian")).addClass('port-header'))
                var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
                getPortInsight(insightResItem.id, function (insightInfo) {
                    $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightInfo.type][insightInfo.nodeConfigId].frameInsightPage,
                        container, insightResItem.nodeId, {
                            source: container,
                            insight: insightInfo,
                            parameters: paramsConfig
                        });
                })
            }
        } else if (TempoMineUtils.isGraph(portType)) {

            container.append($("<h3>").text((insightResItem.subProcessNodeId ? insightResItem.nodeLabel : '') + insightResItem.portLabel).addClass('port-header'))
            var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
            getPortInsight(insightResItem.id, function (insightInfo) {
                $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + (window[insightInfo.type][insightInfo.nodeConfigId].graphInsightExportPage || window[insightInfo.type][insightInfo.nodeConfigId].frameInsightPage),
                    container, insightResItem.nodeId, {
                        source: container,
                        insight: insightInfo,
                        parameters: paramsConfig
                    });
            })
        } else if (TempoMineUtils.isSignal(portType)) {
            var insightInfo = JSON.parse(insightResItem.info);
            var paramsConfig = MineFlowInfo.getParameters(insightResItem.nodeId);
            getPortInsight(insightResItem.id, function (insightInfo) {
                //信号数据集和节点洞察位置互换，波形图和输出数据位置互换
                //是否展示信号数据集
                if (insightInfo.isShowSignalData || insightInfo.showSignalData) {
                    //信号数据集标签
                    container.append($("<h3>").text(insightResItem.portLabel).addClass('port-header'));
                    //是否展示波形图
                    if (insightInfo.isShowWaveFrom || insightInfo.showWaveFrom) {
                        container.append($("<h3>").text(TempoUtils.locale("mine.waveform")).addClass('port-header'))
                        var formatData = createFormatData(insightInfo);
                        var rs = $('<div class="rs_signal_wavefrom" style="margin-top: 10px;"></div>').appendTo(container);
                        createWaveform(formatData, rs, insightResItem.id);
                        //把所有波形图向左移动50px
                        rs.find("[id^='waveformDiv']").css("margin-left", "-50px");
                    }
                    //输出数据标签
                    container.append($("<h3>").text(TempoUtils.locale("mine.originalData")).addClass('port-header'));
                    //信号数据展示
                    insightInfo.flag = window.mineConstant.PORT_SIGNAL;
                    var rs = $('<div class="rs_signal_data" style="margin-top: 10px;"></div>').appendTo(container);
                    //通过导出word的数据长度datalength控制数据集表格行数
                    spliceResultTableDataByDataLength(insightInfo);
                    createResTable(insightInfo, rs, window.mineConstant.PORT_SIGNAL);
                }
                //是否展示节点信息
                if (insightInfo.isShowNodeData || insightInfo.showNodeData) {
                    container.append($("<h3>").text((insightResItem.subProcessNodeId ? insightResItem.nodeLabel : '') + TempoUtils.locale("mine.jiedian")).addClass('port-header'));
                    $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + (window[insightInfo.type][insightInfo.nodeConfigId].graphInsightExportPage || window[insightInfo.type][insightInfo.nodeConfigId].frameInsightPage),
                        container, insightResItem.nodeId, {
                            source: container,
                            insight: insightInfo,
                            parameters: paramsConfig
                        });
                }
            })
        } else {
            getPortInsight(insightResItem.id, function (insightInfo) {
                $m.loadHtmlSyn(contextPath + '/api/ai/mine/' + window[insightInfo.type][insightInfo.nodeConfigId].frameInsightPage,
                    container, insightResItem.nodeId, {source: container, insight: insightInfo});
            })
        }

        var h4 = container.find('h1');
        if (h4 && h4.size() > 0) {
            h4.replaceWith(function () {
                var text = $(this).text();
                return "<h4 class='accordionpanel-header'>" + text + "</h4>"
            })
        }

    }
    var getPortInsight = function (id, callback) {
        postInsight({
            url: contextPath + "/api/ai/mine/searchInsightInfoById",
            async: false,
            data: {
                id: id,
                exeId: exeId,
            },
            type: 'post',
            success: function (data) {
                if (data && data.success != undefined) {
                    data = data.data;
                }
                if(data.nodeConfigId == "tensorflow" && !data.resultTableData){
                    data.resultTableData = data.resultDataset;
                }
                callback(data);
            },
            error: function () {
            }
        })
    }
    var cateNodes = function (insightResult, filterCondition, portsArray) {
        result = generateCategoryData(insightResult, filterCondition, portsArray);
        var nodes = []
        for (var i = 0; i < result.length; i++) {
            var node = result[i];
            if (node.type == "dm_featureeng" || node.type == "dm_extend" || node.type == "dm_funsion" || node.type == "dm_signal") {
                node.nodeType = node.type;
            }
            if (node.nodeConfig == "data_input" || node.nodeConfig == "data_output") {
                node.nodeType = node.nodeConfig;
            }
            var curInfo = node.info ? JSON.parse(node.info) : {};
            var nodeType = node.nodeType;
            var type = node.type;
            //信号节点加注释
            if (type == "dm_signal") {
                node.locType = "signal_process";
            }
            //处理nodeType==null nodeType.indexOf报错问题
            if ((nodeType != null && nodeType.indexOf(filterCondition) != -1) ||
                curInfo.locType == filterCondition ||
                node.locType == filterCondition ||
                curInfo.type == filterCondition || ("user_defined" == type && "user_defined" == filterCondition)) {
                nodes.push(node);
            }
        }
        return nodes;
    }

    var loadNodes = function () {
        loadNodeInsight('data_input', [window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.data_input"));
        loadNodeInsight('preprocess', [window.mineConstant.PORT_NODE_DEFAULT, window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.ai_process"));
        loadNodeInsight('dm_funsion', [window.mineConstant.PORT_NODE_DEFAULT, window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.ai_fusion"));
        loadNodeInsight('dm_featureeng', [window.mineConstant.PORT_NODE_DEFAULT, window.mineConstant.PORT_MODEL, window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.ai_featureeng"));
        loadNodeInsight('datamine', [window.mineConstant.PORT_MODEL, window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.ai_arithmetic"));
        loadNodeInsight('dm_statistics', [window.mineConstant.PORT_GRAPH, window.mineConstant.PORT_DATASET, window.mineConstant.PORT_MODEL], TempoUtils.locale("mine.ai_statistics"));
        loadNodeInsight('dm_deeplearning', [window.mineConstant.PORT_NODE_DEFAULT, window.mineConstant.PORT_MODEL, window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.ai_deeplearing"));
        loadNodeInsight('dm_integratedlearning', [window.mineConstant.PORT_MODEL, window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.ai_integratedlearing"));
        loadNodeInsight('dm_autolearning', [window.mineConstant.PORT_MODEL, window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.ai_auto"));
        loadNodeInsight('dm_extend', [window.mineConstant.PORT_MODEL, window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.ai_extend"));
        loadNodeInsight('dm_textminging', [window.mineConstant.PORT_MODEL, window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.ai_textmining"));
        loadNodeInsight('dm_model', [window.mineConstant.PORT_MODEL, window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.ai_modelmanager"));
        loadNodeInsight('minechart', [window.mineConstant.PORT_GRAPH], TempoUtils.locale("mine.ai_graphic"));
        loadNodeInsight('dm_control', [window.mineConstant.PORT_MODEL, window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.ai_control"));
        loadNodeInsight('dm_cf', [window.mineConstant.PORT_MODEL, window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.ai_cf"));
        loadNodeInsight('user_defined', [window.mineConstant.PORT_NODE_DEFAULT, window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.userdefined"))
        loadNodeInsight('data_output', [window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.data_output"));
        loadNodeInsight('dm_signal', [window.mineConstant.PORT_DATASET], TempoUtils.locale("mine.ai_signal"));
        if (mask) {
            mask.tempoprogressbar('close');
        }

    }

    /**
     * 缓存流程信息，用来节点信息获取
     * */
    var cacheFlowData = function (param) {
        var flowData;
        if (typeof param == "string") {
            flowData = JSON.parse(param);
        } else {
            flowData = param;
        }
        var data = processChildrenPosition(flowData.children);
        var height = data.maxY - data.minY + 180;
        $('#tempo-mine-summary-flow').height(height);
        MineFlowInfo = (function () {
            return {
                getParameters: function (id) {
                    /**
                     * 获取节点配置信息（包含子流程内部节点）
                     */
                    var _findData = function (pathId, navData) {
                        var navId = navData.eid;
                        if (navId == pathId) {
                            return navData.parameters;
                        } else if (navData.process) {
                            navId = navData.process.id;
                            navData = navData.process.flow;
                        }
                        if (navId == pathId) {
                            return navData.parameters;
                        } else {
                            if (navData && navData.children) {
                                var navs = navData.children;
                                if (navs) {
                                    for (var i = 0; i < navs.length; i++) {
                                        var nav = navs[i];
                                        var data = _findData(pathId, nav);
                                        if (data != null) {
                                            return data;
                                        }
                                    }
                                }
                            }
                        }
                    };
                    if (flowData && flowData.children) {
                        return _findData(id, flowData);
                    }
                    return {};
                }
            }
        })();
    }

    var capture = function () {
        if (flowNoteBookList.length > 0) {
            var summaryPanel = $('#summary-container');
            var noteBook = $('<div id="tempo-mine-flow-note-book">').appendTo(summaryPanel);
            var flowHtml = "<h3 class='port-header'>流程注释</h3>";
            for (var i = 0; i < flowNoteBookList.length; i++) {
                flowHtml += "<p style='word-break: break-all;'>" + flowNoteBookList[i].replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</p>";
            }
            noteBook.append(flowHtml);
        }
        if (!mask) {
            mask = $("<div/>").tempoprogressbar();
        }
        setTimeout(function () {
            var imgs = $('#tempo-mine-summary-flow img');

            imageUrlToBase64(imgs, 0, function () {

                //处理连线，将连线转化成div元素
                var flowSvgs = $('#tempo-mine-summary-flow svg');
                flowSvgs.each(function () {
                    var svgTag = this;
                    $(this).removeAttr('xmlns');
                    var c = document.createElement('canvas');
                    c.width = svgTag.clientWidth;
                    c.height = svgTag.clientHeight;
                    c.style.left = svgTag.style.left;
                    c.style.top = svgTag.style.top;
                    c.style.position = svgTag.style.position;
                    svgTag.parentNode.insertBefore(c, svgTag);
                    svgTag.parentNode.removeChild(svgTag);
                    var div = document.createElement('div');
                    div.appendChild(svgTag);
                    canvg(c, div.innerHTML);
                });
                //处理流程图，将流程图转化为图片
                for (var i = 0; i < $('#tempo-mine-summary-flow .tempo-board-container').length; i++) {
                    (function (i) {
                        var flowBoard = $('#tempo-mine-summary-flow .tempo-board-container').get(i);
                        html2canvas(flowBoard, {
                            chinese: true,
                            allowTaint: true,
                            width: flowBoard.scrollWidth,
                            height: flowBoard.scrollHeight,
                        }).then(function (canvas) {
                            //清空子元素
                            $(flowBoard).empty();
                            //追加图片
                            $('<img>').appendTo($(flowBoard)).attr('src', canvas.toDataURL())
                                .attr('width', $(flowBoard).parent().width())
                                .attr('height', $(flowBoard).parent().height());
                            if (mask) {
                                mask.tempoprogressbar('close');
                            }
                            //隐藏父元素横向滚动条
                            $(flowBoard).parent().css("overflow-x", "hidden");
                            $('#summary-container').find('.accordionpanel-header-link').show();
                        });
                    })(i)
                }
                setTimeout(function () {
                    loadNodes();
                }, 100)
            });

        }, 500)
    }

    $.ajax({
        url: contextPath + "/api/ai/mine/load",
        dataType: 'json',
        type: 'post',
        success: function (data) {
            if (typeof data.alg == "string") {
                data.alg = JSON.parse(data.alg);
                data.i18ndict = JSON.parse(data.i18ndict);
            }
            var alg = data.alg;

            //将获取的所有算法节点保存到页面window对象中
            TempoMineUtils.saveAllAlgorithmNodeInfoToWindow(alg);

            //将国际化字典保存
            var i18ns = data[window.constant.I18NDICT];
            for (var i in i18ns) {
                TempoUtils.locale(i, i18ns[i]);
            }
            var groupByCategory = function (eles) {
                for (var p in eles) {
                    var ele = eles[p];
                    window[window.constant.MNODES][ele.id] = ele;
                }
            }

            //将获取的所有算法节点图标保存到页面window对象中
            TempoMineUtils.saveAllAlgorithmNodeIconToWindow(groupByCategory);

            loadOver();
        }
    });


    var showClusterRes = function (info, parentEle) {
        var featuresCol = info.featuresCol;
        var centerTable = info.centerTable;
        var distanceTable = info.distanceTable;
        if (distanceTable && distanceTable.length < 1) {
            TempoMineInsightUtils.showNullModelInsight(parentEle);
            parentEle.find("#mine-clustering-vcluster-model-info-outer").remove();
        } else {
            var clustervarImportanceDiv = $('<div/>').appendTo(parentEle);
            var var2Importance = info.var2Importance;
            if (var2Importance) {
                TempoMineChartUtils.drawVarImportanceChart(var2Importance, clustervarImportanceDiv[0], 1000, 400);
            } else {
                clustervarImportanceDiv.hide();
            }
            parentEle.append($("<p>" + TempoUtils.locale("mine.cluster_graphic") + "</p>"))
            var clusterTableInfo = $('<div/>').appendTo(parentEle);
            var clusterPicDataList = info.clusterPicDataList;
            var clusterPicType = info.clusterPicType;
            var classNum = info.classNum;
            var xyTitles = info.xyTitles;
            var dataset = [];
            for (var i = 0; i < classNum.length; i++) {
                var item = [];
                item.push(TempoUtils.locale("mine.cluster") + (i + 1));
                item.push(classNum[i]);
                dataset.push(item);
            }
            renderClusterPie(clusterTableInfo.get(0), dataset);
            if (clusterPicType == 'lessTwoCols') {
                clusterTableInfo.append('<p>' + TempoUtils.locale('mine.clusterPicBlack') + '</p>');
            } else {
                var pointArr = [], width = clusterTableInfo.width(),
                    height = 400;
                var labelColors = [];
                var clusterNum = clusterPicDataList.length;
                for (var i = 0; i < clusterPicDataList.length; i++) {
                    if (clusterPicType == 'noNormCols') {
                        var clusterPicData = clusterPicDataList[i];
                        var x = clusterPicData.split(";")[0].split(',')[0];
                        var y = clusterPicData.split(";")[0].split(',')[1];
                        var label = parseInt(clusterPicData.split(";")[1]);
                        if (!labelColors[label]) {
                            labelColors[label] = getColorsArray(label);
                        }
                        pointArr.push([x, y, label]);
                    } else if (clusterPicType == 'oneNormCols') {
                        var clusterPicData = clusterPicDataList[i];
                        var x = clusterPicData.split(";")[0].split(',')[0];
                        var y = clusterPicData.split(";")[0].split(',')[1];
                        var label = parseInt(clusterPicData.split(";")[1]);
                        var num = parseInt(clusterPicData.split(";")[2]);
                        if (!labelColors[label]) {
                            labelColors[label] = getColorsArray(label);
                        }
                        pointArr.push([x, y, label, num]);
                    } else if (clusterPicType == 'overTwoNormCols') {
                        var clusterPicData = clusterPicDataList[i];
                        var x = clusterPicData.split(";")[0].split(',')[0];
                        var y = clusterPicData.split(";")[0].split(',')[1];
                        var label = parseInt(clusterPicData.split(";")[1]);
                        var num = parseInt(clusterPicData.split(";")[2]);
                        if (!labelColors[label]) {
                            labelColors[label] = getColorsArray(label);
                        }
                        pointArr.push([x, y, label, num]);
                    }
                }

                // 加一条提示语句
                var tipDiv = $("<div>").appendTo(clusterTableInfo.get(0));
                $("<div style='color: blue;padding-right:30px; float: right'><label>" + TempoUtils.locale("mine.tophelptip") + "</label></div>").appendTo(tipDiv);
                if (clusterPicType == 'noNormCols') {
                    drawNumScatterChartNum1(width, height, pointArr, labelColors, clusterTableInfo.get(0), centerTable, classNum, xyTitles);
                } else if (clusterPicType == 'oneNormCols') {
                    drawNumScatterChartOneNorm1(width, height, pointArr, labelColors, clusterTableInfo.get(0), centerTable, classNum, xyTitles);
                } else if (clusterPicType == 'overTwoNormCols') {
                    drawNumScatterChartOverNorm1(width, height, pointArr, labelColors, clusterTableInfo.get(0), centerTable, classNum, xyTitles);
                }
            }

            parentEle.append($("<p'>" + TempoUtils.locale("mine.cluster_center_table") + "</p>"))
            var clusterTableInfo2 = $('<div/>').appendTo(parentEle);
            var centerTa = $('<table/>').appendTo(clusterTableInfo2);
            var thead = '<thead><tr>';
            var tbody = '<tbody>';
            var classNum = info.classNum;
            for (var i = 0; i < centerTable.length; i++) {
                var row = centerTable[i];
                if (i == 0) {
                    thead += '<th>' + TempoUtils.locale("mine.mine_fields") + '</th>';
                    for (var j = 0; j < row.length; j++) {
                        thead += "<th>" + row[j] + "</th>";
                    }
                    thead += '<th>' + TempoUtils.locale("mine.cluster_num") + '</th>';
                } else {
                    tbody += '<tr><td>' + TempoUtils.locale("mine.cluster_center").replace("replace_this", i) + '</td>';
                    for (var j = 0; j < row.length; j++) {
                        var num = Number(row[j]);
                        if (!isNaN(num)) {
                            row[j] = TempoMineUtils.format(row[j]);
                        }
                        tbody += "<td>" + row[j] + "</td>";
                    }
                    tbody += "<td>" + classNum[i - 1] + "</td>";
                    tbody += '</tr>';
                }
            }
            thead += '</tr></thead>';
            tbody += '</tbody>';
            $(thead).appendTo(centerTa);
            $(tbody).appendTo(centerTa);

            parentEle.append($("<p>" + TempoUtils.locale("mine.cluster_center_distance_table") + "</p>"));
            var clusterTableInfo3 = $('<div/>').appendTo(parentEle);
            var distanceTa = $('<table/>').appendTo(clusterTableInfo3);
            var head = '<thead><tr><th>' + TempoUtils.locale("mine.center_distance") + '</td>';
            for (var i = 0; i < distanceTable.length; i++) {
                head += '<th>' + TempoUtils.locale("mine.cluster") + (i + 1) + '</th>';
            }
            head += '</tr></thead>';
            $(head).appendTo(distanceTa);
            var tbody = '<tbody>';
            for (var i = 0; i < distanceTable.length; i++) {
                var tr = '<tr><td>' + TempoUtils.locale("mine.cluster") + (i + 1) + '</td>';
                var row = distanceTable[i];
                for (var j = 0; j < row.length; j++) {
                    var num = Number(row[j]);
                    if (!isNaN(num)) {
                        row[j] = TempoMineUtils.format(row[j]);
                    }
                    tr += '<td>' + row[j] + '</td>';
                }
                tr += '</tr>';
                tbody += tr;
            }
            tbody += '</tbody>';
            $(tbody).appendTo(distanceTa);
        }


    }
    /**
     * 初始化保存节点的节点注释
     * @param param
     */
    var initNoteBook = function (param) {
        if (typeof (param) == "string") {
            param = JSON.parse(param);
        }
        var children = param.children;
        for (var i = 0; i < children.length; i++) {
            var node = children[i];
            if (node.nodeType == "commentbox") {
                if (node.parameters.comment_type == "process_comment") {
                    flowNoteBookList.push(node.parameters.contents)
                } else {
                    var nodeName = "";
                    if (nodenoteBookMap[node.nodeUuid.replace("_NOTE_node", "")] == undefined) {
                        nodenoteBookMap[node.nodeUuid.replace("_NOTE_node", "")] = [];
                    }
                    nodenoteBookMap[node.nodeUuid.replace("_NOTE_node", "")].push(node.parameters.contents);
                }
            } else if (node.process && node.process.flow) {
                initNoteBook(node.process.flow);
            }
        }
    }
    //渲染流程图包含子流程图
    var readerFlowBoard = function (outerDiv, params, id, flowName) {
        var content;
        if (typeof params == "string") {
            content = JSON.parse(params);
        } else {
            content = params;
        }
        if (!flowName) {
            flowName = content.name;
        }
        outerDiv.append("<h2 title='" + flowName + "' class='node-header'>" + flowName + "</h2>");
        var board = $('<div id="' + id + '"></div>')
            .appendTo(outerDiv).css({
                'height': outerDiv.innerHeight(),
                width: outerDiv.innerWidth(),
                'overflow-x': 'auto'
            });
        //注册洞察面板缩放事件，改变描述中流程图展示面板
        Eventbus.one('viewingResize.mine', function () {
            var coner = board.miningboard("getLeftAndTop");
            if (coner.left + 50 > outerDiv.innerWidth()) {
                board.css({width: coner.left + 50});
            } else {
                board.css({width: outerDiv.innerWidth()});
            }
            board.miningboard("updateSize");
        });
        renderBoard(content || {}, board, null, null, true);
        board.miningboard("updateSize");
        //处理在谷歌87上html2canvans截出来的图没有textarea中的内容的问题
        var textareas = board.find("textarea");
        for (var i = 0; i < textareas.length; i++) {
            $(board.find("textarea").get(i)).css("display", "none");
            $(board.find("textarea").get(i)).next().css("text-indent", "5px").css("text-align", "left")
                .css("white-space", "pre-wrap").css("line-height", "20px").css("word-break", "break-all").text($(board.find("textarea").get(i)).val())
        }
        content = content.flowInfo ? JSON.parse(content.flowInfo) : content;
        if (content.children && content.children.length > 0) {
            for (var i = 0; i < content.children.length; i++) {
                if (content.children[i].process && content.children[i].process.flow) {
                    readerFlowBoard(outerDiv, content.children[i].process.flow, id + i, flowName + " - " + content.children[i].alias);
                }
            }
        }

    }
    var getConnections = function (params) {
        connections = connections.concat(params.connections);
        if (params.children && params.children.length > 0) {
            for (var i = 0; i < params.children.length; i++) {
                if (params.children[i].process && params.children[i].process.flow) {
                    getConnections(params.children[i].process.flow);
                }
            }
        }
    }

    //绘制流程图flowid, flowDiv, flowDiv, cacheFlowData, true
    var loadInputdata = function (pid, outerDiv, viewDiv, callback, zoom, cap) {

        var pro = $("<div/>").tempoprogressbar();
        outerDiv.empty();
        postInsight({
            url: contextPath + "/api/ai/mine/getObjectFlowInfoForView",
            data: {
                flowId: pid,
                exeId: exeId,
            },
            type: 'post',
            dataType: 'json',
            success: function (params) {
                var orgParams = TempoUtils.clone(params);
                if (params && params.success != undefined) {
                    params = params.data;
                }
                if (flowNameTitle) {
                    params.name = flowNameTitle;
                    orgParams.name = flowNameTitle;
                }
                initNoteBook(params.flowInfo);
                if (typeof params.flowInfo == "string") {
                    params = JSON.parse(params.flowInfo);
                }
                //拿到当前流程的所有连线   确保展示的数据是流程图中的节点
                getConnections(params);
                if (callback) callback(params)
                orgParams.flowInfo = JSON.stringify(params);
                readerFlowBoard(outerDiv, orgParams || {}, "tempo-mine-input-flow-view-board");
                outerDiv.css("height", outerDiv[0].scrollHeight);
                // renderBoard(params || {}, board);
                // // 为什么要添加这一句代码
                // //$(".tempo-miningnode .tempo-icon-item-span-text").removeClass("tempo-icon-item-span-text").addClass("tempo-icon-item-span-text-export");
                // board.miningboard("updateSize");
//				if(zoom){
//					var p = board.find('.tempo-board-container');
//					var val = board.width() / board.find('.tempo-board-container').width();
//					if(p[0].style.transform === undefined){
//						p[0].style.zoom = val*100 + "%"; 
//					}else{
//						p[0].style.transform = "scale(" + val +")"; 
//						p[0].style.transformOrigin = "top";  
//					}
//					board.miningboard('setZoom', val, [0.5, 0]);
//				}

                if (cap && $.isFunction(cap)) {
                    cap();
                }
            },
            complete: function () {
                pro.tempoprogressbar("close");
            },
            error: function () {

            }
        });

    }

    /**
     * 通过导出word的数据长度datalength控制数据集表格行数
     * @param insightInfo
     */
    var spliceResultTableDataByDataLength = function (insightInfo) {
        datalength = Number(datalength);
        var dLength = insightInfo.resultTableData.length - 2;
        if (insightInfo.resultTableData.length == 103) {
            dLength--;
        }
        if (datalength < dLength) {
            insightInfo.resultTableData.splice(datalength + 2, dLength - datalength)
            //获取到表格列数
            var resultLength = insightInfo.resultTableData[insightInfo.resultTableData.length - 1].length;
            var flag = true;
            //构造最后一行的省略号
            var endList = [];
            for (var i = 0; i < resultLength; i++) {
                endList.push("...");
            }
            //判断若当前表格数据中已有省略号则不增加省略号
            if (resultLength > 0 && insightInfo.resultTableData[insightInfo.resultTableData.length - 1][0] != "...") {
                insightInfo.resultTableData.push(endList);
            }
        }
    }

})